package com.cgy.utils.tokenizer.segment;

import com.hankcs.hanlp.corpus.tag.Nature;
import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 结果
 * @author Administrator
 *
 */
@Getter
@Setter
public class Serpentine {
	
	private List<String> words;
	private Map<String, String> wordAndSpeech;
	
	/**
	 * 
	 * @param word
	 * @return
	 */
	public Serpentine append(String word) {
		if(null == words) {
			words = new ArrayList<>();
		}
		words.add(word);
		return this;
	}

	/**
	 *
	 * @param word
	 * @param nature
	 * @return
	 */
    public Serpentine put(String word, Nature nature) {
		if(null == wordAndSpeech) {
			wordAndSpeech = new HashMap<>();
		}
		wordAndSpeech.put(word, nature.toString());
		return this;
    }
}
